Optimal. Leaf size=175 \[ -\frac {b c-a d}{2 f \left (a^2+b^2\right ) (a+b \tan (e+f x))^2}-\frac {a^2 (-d)+2 a b c+b^2 d}{f \left (a^2+b^2\right )^2 (a+b \tan (e+f x))}+\frac {\left (a^3 (-d)+3 a^2 b c+3 a b^2 d-b^3 c\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{f \left (a^2+b^2\right )^3}+\frac {x \left (a^3 c+3 a^2 b d-3 a b^2 c-b^3 d\right )}{\left (a^2+b^2\right )^3} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.27, antiderivative size = 175, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.130, Rules used = {3529, 3531, 3530} \[ -\frac {b c-a d}{2 f \left (a^2+b^2\right ) (a+b \tan (e+f x))^2}-\frac {a^2 (-d)+2 a b c+b^2 d}{f \left (a^2+b^2\right )^2 (a+b \tan (e+f x))}+\frac {\left (3 a^2 b c+a^3 (-d)+3 a b^2 d-b^3 c\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{f \left (a^2+b^2\right )^3}+\frac {x \left (3 a^2 b d+a^3 c-3 a b^2 c-b^3 d\right )}{\left (a^2+b^2\right )^3} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3529
Rule 3530
Rule 3531
Rubi steps
\begin {align*} \int \frac {c+d \tan (e+f x)}{(a+b \tan (e+f x))^3} \, dx &=-\frac {b c-a d}{2 \left (a^2+b^2\right ) f (a+b \tan (e+f x))^2}+\frac {\int \frac {a c+b d-(b c-a d) \tan (e+f x)}{(a+b \tan (e+f x))^2} \, dx}{a^2+b^2}\\ &=-\frac {b c-a d}{2 \left (a^2+b^2\right ) f (a+b \tan (e+f x))^2}-\frac {2 a b c-a^2 d+b^2 d}{\left (a^2+b^2\right )^2 f (a+b \tan (e+f x))}+\frac {\int \frac {a^2 c-b^2 c+2 a b d-\left (2 a b c-a^2 d+b^2 d\right ) \tan (e+f x)}{a+b \tan (e+f x)} \, dx}{\left (a^2+b^2\right )^2}\\ &=\frac {\left (a^3 c-3 a b^2 c+3 a^2 b d-b^3 d\right ) x}{\left (a^2+b^2\right )^3}-\frac {b c-a d}{2 \left (a^2+b^2\right ) f (a+b \tan (e+f x))^2}-\frac {2 a b c-a^2 d+b^2 d}{\left (a^2+b^2\right )^2 f (a+b \tan (e+f x))}+\frac {\left (3 a^2 b c-b^3 c-a^3 d+3 a b^2 d\right ) \int \frac {b-a \tan (e+f x)}{a+b \tan (e+f x)} \, dx}{\left (a^2+b^2\right )^3}\\ &=\frac {\left (a^3 c-3 a b^2 c+3 a^2 b d-b^3 d\right ) x}{\left (a^2+b^2\right )^3}+\frac {\left (3 a^2 b c-b^3 c-a^3 d+3 a b^2 d\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{\left (a^2+b^2\right )^3 f}-\frac {b c-a d}{2 \left (a^2+b^2\right ) f (a+b \tan (e+f x))^2}-\frac {2 a b c-a^2 d+b^2 d}{\left (a^2+b^2\right )^2 f (a+b \tan (e+f x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] time = 4.49, size = 243, normalized size = 1.39 \[ -\frac {(b c-a d) \left (\frac {b \left (\frac {\left (a^2+b^2\right ) \left (5 a^2+4 a b \tan (e+f x)+b^2\right )}{(a+b \tan (e+f x))^2}+\left (2 b^2-6 a^2\right ) \log (a+b \tan (e+f x))\right )}{\left (a^2+b^2\right )^3}+\frac {i \log (-\tan (e+f x)+i)}{(a+i b)^3}-\frac {\log (\tan (e+f x)+i)}{(b+i a)^3}\right )+d \left (\frac {2 b \left (\frac {a^2+b^2}{a+b \tan (e+f x)}-2 a \log (a+b \tan (e+f x))\right )}{\left (a^2+b^2\right )^2}+\frac {i \log (-\tan (e+f x)+i)}{(a+i b)^2}-\frac {i \log (\tan (e+f x)+i)}{(a-i b)^2}\right )}{2 b f} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [B] time = 1.51, size = 501, normalized size = 2.86 \[ \frac {2 \, {\left ({\left (a^{5} - 3 \, a^{3} b^{2}\right )} c + {\left (3 \, a^{4} b - a^{2} b^{3}\right )} d\right )} f x + {\left (2 \, {\left ({\left (a^{3} b^{2} - 3 \, a b^{4}\right )} c + {\left (3 \, a^{2} b^{3} - b^{5}\right )} d\right )} f x + {\left (5 \, a^{2} b^{3} - b^{5}\right )} c - 3 \, {\left (a^{3} b^{2} - a b^{4}\right )} d\right )} \tan \left (f x + e\right )^{2} - {\left (7 \, a^{2} b^{3} + b^{5}\right )} c + {\left (5 \, a^{3} b^{2} - a b^{4}\right )} d + {\left ({\left ({\left (3 \, a^{2} b^{3} - b^{5}\right )} c - {\left (a^{3} b^{2} - 3 \, a b^{4}\right )} d\right )} \tan \left (f x + e\right )^{2} + {\left (3 \, a^{4} b - a^{2} b^{3}\right )} c - {\left (a^{5} - 3 \, a^{3} b^{2}\right )} d + 2 \, {\left ({\left (3 \, a^{3} b^{2} - a b^{4}\right )} c - {\left (a^{4} b - 3 \, a^{2} b^{3}\right )} d\right )} \tan \left (f x + e\right )\right )} \log \left (\frac {b^{2} \tan \left (f x + e\right )^{2} + 2 \, a b \tan \left (f x + e\right ) + a^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) + 2 \, {\left (2 \, {\left ({\left (a^{4} b - 3 \, a^{2} b^{3}\right )} c + {\left (3 \, a^{3} b^{2} - a b^{4}\right )} d\right )} f x + 3 \, {\left (a^{3} b^{2} - a b^{4}\right )} c - {\left (2 \, a^{4} b - 3 \, a^{2} b^{3} + b^{5}\right )} d\right )} \tan \left (f x + e\right )}{2 \, {\left ({\left (a^{6} b^{2} + 3 \, a^{4} b^{4} + 3 \, a^{2} b^{6} + b^{8}\right )} f \tan \left (f x + e\right )^{2} + 2 \, {\left (a^{7} b + 3 \, a^{5} b^{3} + 3 \, a^{3} b^{5} + a b^{7}\right )} f \tan \left (f x + e\right ) + {\left (a^{8} + 3 \, a^{6} b^{2} + 3 \, a^{4} b^{4} + a^{2} b^{6}\right )} f\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 0.83, size = 426, normalized size = 2.43 \[ \frac {\frac {2 \, {\left (a^{3} c - 3 \, a b^{2} c + 3 \, a^{2} b d - b^{3} d\right )} {\left (f x + e\right )}}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} - \frac {{\left (3 \, a^{2} b c - b^{3} c - a^{3} d + 3 \, a b^{2} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} + \frac {2 \, {\left (3 \, a^{2} b^{2} c - b^{4} c - a^{3} b d + 3 \, a b^{3} d\right )} \log \left ({\left | b \tan \left (f x + e\right ) + a \right |}\right )}{a^{6} b + 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} + b^{7}} - \frac {9 \, a^{2} b^{3} c \tan \left (f x + e\right )^{2} - 3 \, b^{5} c \tan \left (f x + e\right )^{2} - 3 \, a^{3} b^{2} d \tan \left (f x + e\right )^{2} + 9 \, a b^{4} d \tan \left (f x + e\right )^{2} + 22 \, a^{3} b^{2} c \tan \left (f x + e\right ) - 2 \, a b^{4} c \tan \left (f x + e\right ) - 8 \, a^{4} b d \tan \left (f x + e\right ) + 18 \, a^{2} b^{3} d \tan \left (f x + e\right ) + 2 \, b^{5} d \tan \left (f x + e\right ) + 14 \, a^{4} b c + 3 \, a^{2} b^{3} c + b^{5} c - 6 \, a^{5} d + 7 \, a^{3} b^{2} d + a b^{4} d}{{\left (a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}\right )} {\left (b \tan \left (f x + e\right ) + a\right )}^{2}}}{2 \, f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [B] time = 0.32, size = 483, normalized size = 2.76 \[ -\frac {\ln \left (a +b \tan \left (f x +e \right )\right ) a^{3} d}{f \left (a^{2}+b^{2}\right )^{3}}+\frac {3 \ln \left (a +b \tan \left (f x +e \right )\right ) a^{2} b c}{f \left (a^{2}+b^{2}\right )^{3}}+\frac {3 \ln \left (a +b \tan \left (f x +e \right )\right ) a \,b^{2} d}{f \left (a^{2}+b^{2}\right )^{3}}-\frac {\ln \left (a +b \tan \left (f x +e \right )\right ) c \,b^{3}}{f \left (a^{2}+b^{2}\right )^{3}}+\frac {d a}{2 f \left (a^{2}+b^{2}\right ) \left (a +b \tan \left (f x +e \right )\right )^{2}}-\frac {c b}{2 f \left (a^{2}+b^{2}\right ) \left (a +b \tan \left (f x +e \right )\right )^{2}}+\frac {a^{2} d}{f \left (a^{2}+b^{2}\right )^{2} \left (a +b \tan \left (f x +e \right )\right )}-\frac {2 a b c}{f \left (a^{2}+b^{2}\right )^{2} \left (a +b \tan \left (f x +e \right )\right )}-\frac {b^{2} d}{f \left (a^{2}+b^{2}\right )^{2} \left (a +b \tan \left (f x +e \right )\right )}+\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{3} d}{2 f \left (a^{2}+b^{2}\right )^{3}}-\frac {3 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{2} b c}{2 f \left (a^{2}+b^{2}\right )^{3}}-\frac {3 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a \,b^{2} d}{2 f \left (a^{2}+b^{2}\right )^{3}}+\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) c \,b^{3}}{2 f \left (a^{2}+b^{2}\right )^{3}}+\frac {\arctan \left (\tan \left (f x +e \right )\right ) a^{3} c}{f \left (a^{2}+b^{2}\right )^{3}}+\frac {3 \arctan \left (\tan \left (f x +e \right )\right ) a^{2} b d}{f \left (a^{2}+b^{2}\right )^{3}}-\frac {3 \arctan \left (\tan \left (f x +e \right )\right ) a \,b^{2} c}{f \left (a^{2}+b^{2}\right )^{3}}-\frac {\arctan \left (\tan \left (f x +e \right )\right ) b^{3} d}{f \left (a^{2}+b^{2}\right )^{3}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.73, size = 333, normalized size = 1.90 \[ \frac {\frac {2 \, {\left ({\left (a^{3} - 3 \, a b^{2}\right )} c + {\left (3 \, a^{2} b - b^{3}\right )} d\right )} {\left (f x + e\right )}}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} + \frac {2 \, {\left ({\left (3 \, a^{2} b - b^{3}\right )} c - {\left (a^{3} - 3 \, a b^{2}\right )} d\right )} \log \left (b \tan \left (f x + e\right ) + a\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} - \frac {{\left ({\left (3 \, a^{2} b - b^{3}\right )} c - {\left (a^{3} - 3 \, a b^{2}\right )} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} - \frac {{\left (5 \, a^{2} b + b^{3}\right )} c - {\left (3 \, a^{3} - a b^{2}\right )} d + 2 \, {\left (2 \, a b^{2} c - {\left (a^{2} b - b^{3}\right )} d\right )} \tan \left (f x + e\right )}{a^{6} + 2 \, a^{4} b^{2} + a^{2} b^{4} + {\left (a^{4} b^{2} + 2 \, a^{2} b^{4} + b^{6}\right )} \tan \left (f x + e\right )^{2} + 2 \, {\left (a^{5} b + 2 \, a^{3} b^{3} + a b^{5}\right )} \tan \left (f x + e\right )}}{2 \, f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 5.65, size = 279, normalized size = 1.59 \[ -\frac {\ln \left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (\frac {a\,d-3\,b\,c}{{\left (a^2+b^2\right )}^2}-\frac {4\,b^2\,\left (a\,d-b\,c\right )}{{\left (a^2+b^2\right )}^3}\right )}{f}-\frac {\frac {-3\,d\,a^3+5\,c\,a^2\,b+d\,a\,b^2+c\,b^3}{2\,\left (a^4+2\,a^2\,b^2+b^4\right )}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (-d\,a^2\,b+2\,c\,a\,b^2+d\,b^3\right )}{a^4+2\,a^2\,b^2+b^4}}{f\,\left (a^2+2\,a\,b\,\mathrm {tan}\left (e+f\,x\right )+b^2\,{\mathrm {tan}\left (e+f\,x\right )}^2\right )}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (-d+c\,1{}\mathrm {i}\right )}{2\,f\,\left (-a^3-a^2\,b\,3{}\mathrm {i}+3\,a\,b^2+b^3\,1{}\mathrm {i}\right )}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (c-d\,1{}\mathrm {i}\right )}{2\,f\,\left (-a^3\,1{}\mathrm {i}-3\,a^2\,b+a\,b^2\,3{}\mathrm {i}+b^3\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: AttributeError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________